-------------------------
-- 【分频器】
-------------------------


-- 实现1
if (clk = '1' and clk'event) then
    if (counter = "1001") then
        counter <= (others >= 0);
        clk_div10 <= 1;
    else
        counter <= counter + 1;
        clk_div10 <= '0';
    end if;
end if;


-- 实现2（占空比位1/2）
if (clk = '1' and clk'event) then
    if (counter = "1001") then
        counter <= (others >= 0);
        clk_temp <= not clk_temp;
    else
        counter <= counter + 1;
    end if;
end if;
clk_div10 <= clk_temp;
